//
//  WatersItemCell.m
//  Water
//
//  Created by yh on 2017/12/6.
//  Copyright © 2017年 chenguibang. All rights reserved.
//

#import "WatersItemCell.h"
#import <NSDate+GBExt.h>
#import <NSDate+YYAdd.h>
#import <SDWebImage/UIImageView+WebCache.h>
@implementation WatersItemCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
    self.ringBtn.hidden = YES;
}

- (void)setUserBaseinfo:(WaterCenterUser *)userBaseinfo{
    _userBaseinfo = userBaseinfo;
    self.name.text = userBaseinfo.nickname;
    [self.img sd_setImageWithURL:[NSURL URLWithString:userBaseinfo.avatar]];
    
    
    if (userBaseinfo.waterRecords.count > 0) {
        DrinkRecord *record = [userBaseinfo.waterRecords firstObject];
 
        self.drinkInfo.text = [NSString stringWithFormat:@"今日:%dml\n最后:%@",record.amount,[[NSDate dateWithTimeIntervalSince1970:(NSTimeInterval)[record.time integerValue]/1000] stringWithFormat:@"yyyy-MM-dd"]];
    }
    
    
}

@end
